package cn.xhb.mapper;

import cn.xhb.domain.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;


import java.util.List;
@Repository
public interface RoleMapper {
    @Select("select * from sys_role")
    List<Role> findAll();
    @Select("select * from sys_user_role ur,sys_role r where ur.roleId=r.id and ur.userId=#{id}")
    List<Role> findRoleById(Long id);
    @Update("insert into sys_role values(#{id},#{roleName},#{roleDesc})")
    void save(Role role);
    @Delete("delete from sys_role where id=#{roleId}")
    void del(Long roleId);
}
